package com.sociodrive.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;

import com.sociodrive.services.impl.SecurityServiceImpl;
import com.vaadin.Application;
import com.vaadin.ui.Label;
import com.vaadin.ui.Window;

@Configurable
public class LoginPage extends Application {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Autowired
	private SecurityServiceImpl secuirtyService;

	@Autowired
	private Test test;
	@Override
	public void init() {
		Window mainWindow = new Window("Myproject Application");
		/*
		 * Session session = HibernateUtil.getSession(); Transaction transaction
		 * = session.beginTransaction(); User u = new User();
		 * u.setUsername("test"); session.save(u); transaction.commit();
		 */
		Label label = new Label("Hello "+test.getName()
				+ String.valueOf(secuirtyService.validUser("test", "test")));

		mainWindow.addComponent(label);
		setMainWindow(mainWindow);
	}

}
